const { defineConfig } = require('@vue/cli-service')
const bodyParser = require('body-parser')
const Mock=require('mockjs');
let data=Mock.mock({
  "list|5":[{
    "id":"@id",
    "name":"@cword(2,4)",
    "img":"@image(100X70,@color)"
  }]
})
let datalist=Mock.mock({
  "list|8":[{
    "text":"@cword(4)",
    "id":"@id",
    "children|18":[{
      "id":"@id",
      "name":"@cword(2,4)",
      "img":"@image(100X70,@color)"
    }]
    
  }]
})




module.exports = defineConfig({
  transpileDependencies: true,
  devServer:{
    onAfterSetupMiddleware: ({app})=> {
      app.use(bodyParser.json())
      app.get('/list', function (req, res) {
         res.json(datalist.list);
       });
     
     },
  }
})
